#define D2D_INPUT_COUNT 1
#define D2D_INPUT0_COMPLEX

#include "d2d1effecthelpers.hlsli"

float time;
int model =0;

D2D_PS_ENTRY(main){
     //获取当前像素在屏幕上的坐标（相对位置）
    float2 pos = D2DGetInputCoordinate(0).xy;
    float x = pos.x;
    float y = pos.y;
    //从上至下消失
    if(model==0&&y<time){
            return float4(0,0,0,0);
    }
    //从下至上消失
    else if(model ==1&&y>(1-time)){
            return float4(0,0,0,0);
    }
    //从左至右消失
    else if(model ==2&&x<time){
            return float4(0,0,0,0);
    }
    //从右至左消失
    else if(model ==3 && x>(1-time))
    {
        return float4(0,0,0,0);
    }
    //从下至上填充
    else if(model ==4 && y<(1-time)){
        return float4(0,0,0,0);
    }
    //从上至下填充
    else if(model ==5 && y>time){
        return float4(0,0,0,0);
    }
    //从左至右填充
    else if(model==6 && x>time){
        return float4(0,0,0,0);
    }
    //从右至左填充
    else if(model ==7 && x<(1-time)){
        return float4(0,0,0,0);
    }
    //从左上角渐铺至右下
    else if (model ==8&& (x>time || y>time))
    {
        return float4(0,0,0,0);
    }
    //从左下渐铺至右上
    else if(model ==9 &&(x>time ||y<(1-time))){
        return float4(0,0,0,0);
    }
    //从右上渐铺至左下
    else if(model ==10 && (x<1-time|| y>time)){
        return float4(0,0,0,0);
    }
    //从右下渐铺至左上
    else if(model ==11 &&( x<1-time|| y<(1-time)))
    {
        return float4(0,0,0,0);
    }
    //向中间水平合拢
    else if( model ==12 && abs(x-0.5)<(1-time)*0.5){
        return float4(0,0,0,0);
    }
    //向中间垂直合拢
    else if(model==13 && abs(y-0.5)<(1-time)*0.5){
        return float4(0,0,0,0);
    }
    //向两边水平拉开
    else if( model ==14 && abs(x-0.5)>time*0.5){
        return float4(0,0,0,0);
    }
     //向两边垂直拉开
    else if(model==15 && abs(y-0.5)>time*0.5){
        return float4(0,0,0,0);
    }
     return D2DGetInput(0);
}

